home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d7 / lib231.arc / INETPASS.SLT < prev    next >
Text File  |  1990-05-11  |  4KB  |  147 lines

  1. /////////////////////////////// INETPASS.SLT /////////////////////////////////
  2. //
  3. //  INETPASS.SLT Copyright (C) 1989-90 Liberation Enterprises.
  4. //
  5. //  DESCRIPTION:  This script will create the iNet Password file needed for
  6. //  proper operation of INET-ON.SLT.  This password file will be created in
  7. //  your Telix Script directory (defined with the Telix <Alt-O> command, under
  8. //  'Filenames and Paths'), and will be named INETPASS.WRD.
  9. //
  10. //  CREDITS:  This script is modelled after a script originally created by 
  11. //  Robert Wolfe.
  12. //
  13. //  INSTRUCTIONS:  Compile the script by typing 'CS INETPASS' from DOS.  This
  14. //  will produce a file call INETPASS.SLC, which should be copied into your
  15. //  Telix Script directory if necessary.  Then execute the file from Telix by
  16. //  typing <Alt-G>INETPASS.  (<Alt-G> signifies holding the Alt key and typing
  17. //  a G).
  18. //
  19. //  The script INET-ON.SLT that accompanys this file must be modified with your
  20. //  text editor or word processor (in ASCII, or DOS Text file mode) before
  21. //  compiling.  Simply load the INET-ON.SLT file into your text editor, and
  22. //  follow the instructions inside.
  23. //
  24. //////////////////////////////////////////////////////////////////////////////
  25.  
  26. main()
  27. {
  28.  
  29.  int c,
  30.      f,
  31.      i,
  32.      x = 4,
  33.      y,
  34.      digit,
  35.      spchar;
  36.  
  37.  str s[80],
  38.      password_file[64];
  39.  
  40.  if (!_script_dir)
  41.   {
  42.    prints("No Script Directory defined.  Please define and save the directory where your");
  43.    prints("Telix scripts are locates with the Telix <Alt-O> command, and retry.");
  44.    return(0);
  45.   }
  46.  else
  47.   {
  48.    fnstrip(_script_dir, 0, s);
  49.    strupper(s);
  50.    c = strlen(s);
  51.    if (subchr(s, c - 1) != '\')
  52.     copystr("\", s, c, 1);         // add slash if necessary
  53.    _script_dir = s;
  54.   }
  55.  
  56.  password_file = _script_dir;     // Telix script directory");
  57.  strcat(password_file, "INETPASS.WRD");
  58.  
  59.  if (filefind(password_file))
  60.   {
  61.    clear_scr();
  62.    printsc("^GAn iNet password file already exists.  Replace it <y/n>? ");
  63.    gets(s, 1);
  64.    c = tolower(subchr(s, 0));
  65.    if (c != 'y')
  66.     {
  67.      prints("^M^JScript aborted.");
  68.      return(0);
  69.     }
  70.   }
  71.  
  72.  f = fopen(password_file, "w");
  73.  if (!f)
  74.   {
  75.    prints("Error creating password file.  Aborting...");
  76.    return(0);
  77.   }
  78.  fputs("003", f);                 // set pointer to start of passwords
  79.  
  80.  clear_scr();
  81.  prints("Please enter 12 iNet passwords in the following format:^M^J");
  82.  prints("1)    Each password must be 6 to 8 characters long.");
  83.  prints("2)    The first character must be alphabetic or numeric.");
  84.  prints("3)    At least one character must be numeric.");
  85.  prints("4)    At least one character must be special, !, ?, %, *, etc.");
  86.  pstraxy(" Please enter your CURRENT iNet password. ",0,10,112);
  87.  
  88.  while (x < 80)
  89.   {
  90.    digit = spchar = 0;
  91.  
  92.    pstraxy("╒═╤═╤═╦══╕", x, y+12, 2);
  93.    pstraxy("│        │", x, y+13, 2);
  94.    pstraxy("╘═╧═╧═╩══╛", x, y+14, 2);
  95.  
  96.    if (getsxy(s, 8, x+1, y+13, 2) == -1)  // Esc key hit?
  97.     {
  98.      fclose(f);
  99.      s = "DEL ";
  100.      strcat(s, password_file);
  101.      dos(s, 2);                   // Delete password file (incomplete)
  102.      clear_scr();
  103.      prints("Script aborted.  INETPASS.WRD not created.");
  104.      return(0);
  105.     }
  106.  
  107.    c = subchr(s, 0);
  108.    if (!isalnum(c))
  109.     continue;
  110.  
  111.    if (strlen(s) < 6)
  112.     continue;
  113.  
  114.    for (i = 0; i <= strlen(s); ++i)
  115.     {
  116.      c = subchr(s,i);
  117.      if (isdigit(c))
  118.       digit = 1;                       // numeric found
  119.      if (!iscntrl(c) && !isalnum(c))
  120.       spchar = 1;                      // special found
  121.     }
  122.  
  123.    if (!digit || !spchar)
  124.     continue;
  125.  
  126.    fputs(s, f);
  127.    fputs("^J", f);                    // line feed as delimeter
  128.  
  129.    pstraxy(" Please enter your next password in the box. ",0,10,112);
  130.  
  131.    y = y + 4;
  132.    if (y > 9)
  133.     {
  134.      y = 0;
  135.      x = x + 20;
  136.     }
  137.   }
  138.  
  139.  fclose(f);
  140.  clear_scr();
  141.  printsc(_script_dir);
  142.  prints("INETPASS.WRD created.  Script complete.");
  143.  prints("^M^JPlease refer to the instructions in the INET-ON.SLT file for the next step.");
  144.  return(1);
  145. }
  146.  
  147. //////////////////////////////// End of file /////////////////////////////////